package org.abacus.platform.grid.impl;

import org.abacus.platform.grid.GridColumn;

public class GridColumnImpl implements GridColumn {

	/**
	 *
	 */
	private static final long serialVersionUID = 877032116753614029L;

	private String name;
	private String lable;
	private Integer width;
	private boolean visible;
	private boolean editable;
	private boolean sortable;
	private boolean sumable;
	private String align;

	public GridColumnImpl() {
		super();
		this.visible = true;
		this.editable = false;
		this.sortable = false;
		this.sumable = false;
	}

	public String getName() {
		return name;
	}

	public String getLable() {
		return lable;
	}

	public Integer getWidth() {
		return width;
	}

	public boolean getVisible() {
		return visible;
	}

	public boolean getEditable() {
		return editable;
	}

	public boolean getSortable() {
		return sortable;
	}

	public boolean getSumable() {
		return sumable;
	}

	public String getAlign() {
		return align;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setLable(String lable) {
		this.lable = lable;
	}

	public void setWidth(Integer width) {
		this.width = width;
	}

	public void setVisible(boolean visible) {
		this.visible = visible;
	}

	public void setEditable(boolean editable) {
		this.editable = editable;
	}

	public void setSortable(boolean sortable) {
		this.sortable = sortable;
	}

	public void setSumable(boolean sumable) {
		this.sumable = sumable;
	}

	public void setAlign(String align) {
		this.align = align;
	}

	public String toJson(StringBuffer arg0) {
		arg0.append('{');

		arg0.append('"');
		arg0.append("name");
		arg0.append('"');
		arg0.append(':');
		if (null == name) {
			arg0.append("null");
		} else {
			arg0.append('"');
			arg0.append(name);
			arg0.append('"');
		}
		arg0.append(',');

		arg0.append('"');
		arg0.append("lable");
		arg0.append('"');
		arg0.append(':');
		if (null == lable) {
			arg0.append("null");
		} else {
			arg0.append('"');
			arg0.append(lable);
			arg0.append('"');
		}
		arg0.append(',');

		arg0.append('"');
		arg0.append("width");
		arg0.append('"');
		arg0.append(':');
		arg0.append(width);
		arg0.append(',');

		arg0.append('"');
		arg0.append("visible");
		arg0.append('"');
		arg0.append(':');
		arg0.append(visible);
		arg0.append(',');

		arg0.append('"');
		arg0.append("editable");
		arg0.append('"');
		arg0.append(':');
		arg0.append(editable);
		arg0.append(',');

		arg0.append('"');
		arg0.append("sortable");
		arg0.append('"');
		arg0.append(':');
		arg0.append(sortable);
		arg0.append(',');

		arg0.append('"');
		arg0.append("sumable");
		arg0.append('"');
		arg0.append(':');
		arg0.append(sumable);
		arg0.append(',');

		arg0.append('"');
		arg0.append("align");
		arg0.append('"');
		arg0.append(':');
		if (null == align) {
			arg0.append("null");
		} else {
			arg0.append('"');
			arg0.append(align);
			arg0.append('"');
		}

		arg0.append('}');

		return arg0.toString();
	}

	public String toString() {
		StringBuffer sb = new StringBuffer();
		return toJson(sb);
	}
}
